{% set pypi_name = 'python-dracclient' %}
{% set upstream_version = upstream_version('5.1.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Library for managing machines with Dell iDRAC cards.
License:        {{ license('Apache-2.0')}}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('lxml') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('requests') }}
BuildRequires:  {{ py3('requests-mock') }}
Requires:       {{ py3('lxml') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}
BuildArch:      noarch

%description
Library for managing machines with Dell iDRAC cards.

%package doc
Summary:        Documentation for OpenStack Drac API Client
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description doc
This is a client for the OpenStack Drac API and a command-line script (drac).
Each implements 100% of the OpenStack Drac API.
This package contains auto-generated documentation.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

%check
export PYTHONPATH=.:%{buildroot}%{python3_sitelib}
%{__python3} -m unittest discover dracclient.tests

%files
%license LICENSE
%doc README.rst ChangeLog
%{python3_sitelib}/dracclient
%{python3_sitelib}/*.egg-info

%files doc
%license LICENSE
%doc doc/build/html

%changelog
